package com.wing.cabinet.model.response;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.cabinet.model.entity.Cabinet;
import com.wing.cabinet.model.entity.StorageSingleInventoryProduct;
import com.wing.cabinet.utils.ExcelExport;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.net.URL;
import java.time.LocalDateTime;

/**
 * 暂存柜产品库存(单个柜子)VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class StorageSingleInventoryProductVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 库存数量
     */
    @ExcelExport(value = "库存",sort = 8)
    private Integer quantity;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 货道id
     */
    private Integer spaceId;

    /**
     * (0正常，1告警)
     */
    private Long status;

    /**
     * 货道编号
     */
    private String spaceCode;

    /**
     * 柜子编号
     */
    @ExcelExport(value = "柜子编号",sort = 7)
    private String cabCode;

    /**
     * sku 编号
     */
    @ExcelExport(value = "物料编号",sort = 3)
    private String skuCode;

    /**
     * 业务类型
     */
    private StorageSingleInventoryProduct.BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        if (businessType!=null){
            return businessType.getDesc();
        }
        return null;
    }


    /**
     * sku 名称
     */
    @ExcelExport(value = "物料名称",sort = 2)
    private String skuName;

    /**
     * sku 规格
     */
    //@ExcelExport(value = "规格码",sort = 5)
    private String skuSpec;

    /**
     * sku 图片
     */

    private String skuPic;
    //@ExcelExport(value = "产品图片",sort = 1)
    private URL skuPicVo;
    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品类型名称
     */
    private String productTypeName;

    /**
     * 产品分类名称
     */
    private String productCategoryName;

    /**
     * 产品品牌
     */
    @ExcelExport(value = "品牌",sort = 5)
    private String productBrandName;



    private Integer quantityTemp;
    private Integer quantityRepair;

    private Integer quantityRecycle;

    private Integer cabNum;

    private Integer spaceNum;


    /**
     * 市场价
     */
    private BigDecimal marketPrice;

    private Integer quantityMax;

    /**
     * 单位
     */
    @ExcelExport(value = "单位",sort = 9)
    private String unitName;

    @ExcelExport(value = "规格码",sort = 5)
    private String skuSpecOld;

    private String skuCodeOld;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    /**
     * 所属主柜编码
     */
    private String belongCabinet;

    /**
     * 企业自定义柜子名称
     */
    private String cabName;

    private String mainCabCode;

    private Integer quantityPack;

    private Integer quantityPackUnit;

    private Long packId;

    private String packName;

    private Integer quantityNew;
    private String basicsUnitName;


    private Integer quantityPackNew;

    private Integer quantityPackTemp;

    private Integer quantityPackRepair;

    private Integer quantityPackRecycle;

    /**
     * 刀柜性质
     */
    private Cabinet.CabinetNature cabinetNature;

    /**
     * 刀柜性质描述
     */
    private String cabinetNatureDesc;

    public String getCabinetNatureDesc() {
        return cabinetNature == null ? null : cabinetNature.getDesc();
    }
}
